home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3c / getdate.z / getdate
Encoding:
Text File  |  2002-10-03  |  14.3 KB  |  331 lines

  1.  
  2.  
  3.  
  4. ggggeeeettttddddaaaatttteeee((((3333CCCC))))                                                        ggggeeeettttddddaaaatttteeee((((3333CCCC))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _gggg_eeee_tttt_dddd_aaaa_tttt_eeee - convert user format date and time
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_tttt_iiii_mmmm_eeee_...._hhhh_>>>>
  13.  
  14.      _ssss_tttt_rrrr_uuuu_cccc_tttt _tttt_mmmm _****_gggg_eeee_tttt_dddd_aaaa_tttt_eeee _((((_cccc_oooo_nnnn_ssss_tttt _cccc_hhhh_aaaa_rrrr _****_ssss_tttt_rrrr_iiii_nnnn_gggg_))))_;;;;
  15.      _eeee_xxxx_tttt_eeee_rrrr_nnnn _iiii_nnnn_tttt _gggg_eeee_tttt_dddd_aaaa_tttt_eeee______eeee_rrrr_rrrr_;;;;
  16.  
  17. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.      _gggg_eeee_tttt_dddd_aaaa_tttt_eeee The _gggg_eeee_tttt_dddd_aaaa_tttt_eeee function converts a string representation of a date
  19.      or time into a broken-down time.
  20.  
  21.      The external variable or macro _gggg_eeee_tttt_dddd_aaaa_tttt_eeee______eeee_rrrr_rrrr is used by _gggg_eeee_tttt_dddd_aaaa_tttt_eeee_((((_)))) to return
  22.      error values.
  23.  
  24.      Templates are used to parse and interpret the input string.  The
  25.      templates are contained in a text file identified by the environment
  26.      variable _DDDD_AAAA_TTTT_EEEE_MMMM_SSSS_KKKK_....  The DATEMSK variable should be set to indicate the
  27.      full pathname of the file that contains the templates. The first line in
  28.      the template that matches the input specification is used for
  29.      interpretation and conversion into the internal time format.
  30.  
  31.      The following field descriptors are supported:
  32.  
  33.      _%%%%_%%%%   same as _%%%%
  34.  
  35.      _%%%%_aaaa   abbreviated weekday name
  36.  
  37.      _%%%%_AAAA   full weekday name
  38.  
  39.      _%%%%_bbbb   abbreviated month name
  40.  
  41.      _%%%%_BBBB   full month name
  42.  
  43.      _%%%%_cccc   locale's appropriate date and time representation
  44.  
  45.      _%%%%_CCCC   century number (00-99; leading zeros are permitted but not required)
  46.  
  47.      _%%%%_dddd   day of month (01-31; the leading 0 is optional)
  48.  
  49.      _%%%%_DDDD   date as %m/%d/%y
  50.  
  51.      _%%%%_eeee   same as _%%%%d
  52.  
  53.      _%%%%_hhhh   abbreviated month name
  54.  
  55.      _%%%%_HHHH   hour (00-23)
  56.  
  57.      _%%%%_IIII   hour (01-12)
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ggggeeeettttddddaaaatttteeee((((3333CCCC))))                                                        ggggeeeettttddddaaaatttteeee((((3333CCCC))))
  71.  
  72.  
  73.  
  74.      _%%%%_mmmm   month number (01-12)
  75.  
  76.      _%%%%_MMMM   minute (00-59)
  77.  
  78.      _%%%%_nnnn   same as new line
  79.  
  80.      _%%%%_pppp   locale's equivalent of either AM or PM
  81.  
  82.      _%%%%_rrrr   The locale's appropriate representation of time in AM and PM
  83.           notation. In the POSIX locale, this is equivalent to %I:%M:%S %p
  84.  
  85.      _%%%%_RRRR   time as %H:%M
  86.  
  87.      _%%%%_SSSS   seconds (00-61).  Leap seconds are allowed but are not predictable
  88.           through use of algorithms.
  89.  
  90.      _%%%%_tttt   same as tab
  91.  
  92.      _%%%%_TTTT   time as %H:%M:%S
  93.  
  94.      _%%%%_wwww   weekday number (Sunday = 0 - 6)
  95.  
  96.      _%%%%_xxxx   locale's appropriate date representation
  97.  
  98.      _%%%%_XXXX   locale's appropriate time representation
  99.  
  100.      _%%%%_yyyy   year within century. When a century is not otherwise specified,
  101.           values in the range 69-99 refer to years in the twentieth century
  102.           (1969 to 1999 inclusive); values in the range 00-68 refer to years
  103.           in the twenty-first century (2000 to 2068 inclusive).
  104.  
  105.      _%%%%_YYYY   year as ccyy (for example, 1994)
  106.  
  107.      _%%%%_ZZZZ   time zone name or no characters if no time zone exists. If the time
  108.           zone supplied by _%%%%_ZZZZ is not the time zone that _gggg_eeee_tttt_dddd_aaaa_tttt_eeee_((((_)))) expects, an
  109.           invalid input specification error will result.  The _gggg_eeee_tttt_dddd_aaaa_tttt_eeee_((((_))))
  110.           function calculates an expected time zone based on information
  111.           supplied to the function (such as the hour, day, and month).
  112.  
  113.      The match between the template and input specification performed by
  114.      _gggg_eeee_tttt_dddd_aaaa_tttt_eeee_((((_)))) is case insensitive.
  115.  
  116.      The month and weekday names can consist of any combination of upper and
  117.      lower case letters. The process can request that the input date or time
  118.      specification be in a specific language by setting the _LLLL_CCCC______TTTT_IIII_MMMM_EEEE category
  119.      (see _ssss_eeee_tttt_llll_oooo_cccc_aaaa_llll_eeee_((((_))))).
  120.  
  121.      Leading 0's are not necessary for the descriptors that allow leading 0's.
  122.      However, at most two digits are allowed for those descriptors, including
  123.      leading 0's.  Extra whitespace in either the template file or in _ssss_tttt_rrrr_iiii_nnnn_gggg
  124.      is ignored.
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. ggggeeeettttddddaaaatttteeee((((3333CCCC))))                                                        ggggeeeettttddddaaaatttteeee((((3333CCCC))))
  137.  
  138.  
  139.  
  140.      The field descriptors _%%%%_cccc, _%%%%_xxxx, and _%%%%_XXXX will not be supported if they
  141.      include unsupported field descriptors.
  142.  
  143.      The following rules apply for converting the input specification into the
  144.      internal format:
  145.  
  146.           If _%%%%_ZZZZ is being scanned, then _gggg_eeee_tttt_dddd_aaaa_tttt_eeee_((((_)))) initialises the broken-down
  147.           time to be the current time in the scanned time zone. Otherwise it
  148.           initialises the broken-down time based on the current local time as
  149.           if _llll_oooo_cccc_aaaa_llll_tttt_iiii_mmmm_eeee_((((_)))) had been called.
  150.  
  151.           If only the weekday is given, today is assumed if the given day is
  152.           equal to the current day and next week if it is less.
  153.  
  154.           If only the month is given, the current month is assumed if the
  155.           given month is equal to the current month and next year if it is
  156.           less and no year is given (the first day of month is assumed if no
  157.           day is given).
  158.  
  159.           If no hour, minute and second are given the current hour, minute and
  160.           second are assumed,
  161.  
  162.           If no date is given, today is assumed if the given hour is greater
  163.           than the current hour and tomorrow is assumed if it is less.
  164.  
  165.      If a field descriptor specification in the _DDDD_AAAA_TTTT_EEEE_MMMM_SSSS_KKKK file does not
  166.      correspond to one of the field descriptors above, the behaviour is
  167.      unspecified.
  168.  
  169. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
  170.      Upon successful completion, _gggg_eeee_tttt_dddd_aaaa_tttt_eeee_((((_)))) returns a pointer to a _ssss_tttt_rrrr_uuuu_cccc_tttt _tttt_mmmm_....
  171.      Otherwise, it returns a null pointer and _gggg_eeee_tttt_dddd_aaaa_tttt_eeee______eeee_rrrr_rrrr is set to indicate
  172.      the error.
  173.  
  174. EEEERRRRRRRROOOORRRRSSSS
  175.      The _gggg_eeee_tttt_dddd_aaaa_tttt_eeee_((((_)))) function will fail in the following cases, setting
  176.      _gggg_eeee_tttt_dddd_aaaa_tttt_eeee______eeee_rrrr_rrrr to the value shown in the list below.  Any changes to errno
  177.      are unspecified.
  178.  
  179.      1    The _DDDD_AAAA_TTTT_EEEE_MMMM_SSSS_KKKK environment variable is null or undefined.
  180.  
  181.      2    The template file cannot be opened for reading.
  182.  
  183.      3    Failed to get file status information.
  184.  
  185.      4    The template file is not a regular file.
  186.  
  187.      5    An I/O error is encountered while reading the template file.
  188.  
  189.      6    Memory allocation failed (not enough memory available).
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. ggggeeeettttddddaaaatttteeee((((3333CCCC))))                                                        ggggeeeettttddddaaaatttteeee((((3333CCCC))))
  203.  
  204.  
  205.  
  206.      7    There is no line in the template that matches the input.
  207.  
  208.      8    Invalid input specification.  For example, February 31; or a time is
  209.           specified that can not be represented in a _tttt_iiii_mmmm_eeee______tttt (representing the
  210.           time in seconds since 00:00:00 UTC, January 1, 1970).
  211.  
  212. EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  213.      Example 1:
  214.  
  215.      The following example shows the possible contents of a template:
  216.  
  217.           %m
  218.  
  219.           %A %B %d, %Y, %H:%M:%S
  220.  
  221.           %A
  222.  
  223.           %B
  224.  
  225.           %m/%d/%y %I %p
  226.  
  227.           %d,%m,%Y %H:%M
  228.  
  229.           at %A the %dst of %B in %Y
  230.  
  231.           run job at %I %p,%B %dnd
  232.  
  233.           %A den %d. %B %Y %H.%M Uhr
  234.  
  235.      Example 2:
  236.  
  237.      The following are examples of valid input specifications for the template
  238.      in Example 1:
  239.  
  240.           getdate("10/1/87 4 PM");
  241.  
  242.           getdate("Friday");
  243.  
  244.           getdate("Friday September 18, 1987, 10:30:30");
  245.  
  246.           getdate("24,9,1986 10:30");
  247.  
  248.           getdate("at monday the 1st of december in 1986");
  249.  
  250.           getdate("run job at 3 PM, december 2nd");
  251.  
  252.      If the _LLLL_CCCC______TTTT_IIII_MMMM_EEEE category is set to a German locale that includes _ffff_rrrr_eeee_iiii_tttt_aaaa_gggg
  253.      as a weekday name and _oooo_kkkk_tttt_oooo_bbbb_eeee_rrrr as a month name, the following would be
  254.      valid:
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. ggggeeeettttddddaaaatttteeee((((3333CCCC))))                                                        ggggeeeettttddddaaaatttteeee((((3333CCCC))))
  269.  
  270.  
  271.  
  272.           getdate("freitag den 10. oktober 1986 10.30 Uhr");
  273.  
  274.      Example 3:
  275.  
  276.      The following examples shows how local date and time specification can be
  277.      defined in the template.
  278.  
  279.               Invocation                                      Line in Template
  280.  
  281.               getdate("11/27/86")                             %m/%d/%y
  282.               getdate("27.11.86")                             %d.%m.%y
  283.               getdate("86-11-27")                             %y-%m-%d
  284.               getdate("Friday 12:00:00")                      %A %H:%M:%S
  285.  
  286.      Example 4:
  287.  
  288.      The following examples help to illustrate the above rules assuming that
  289.      the current date is Mon Sep 22 12:19:47 EDT 1986 and the _LLLL_CCCC______TTTT_IIII_MMMM_EEEE category
  290.      is set to the default _""""_CCCC_"""" locale.
  291.  
  292.          Input         Line in Template    Date
  293.  
  294.          Mon           %a                  Mon Sep 22 12:19:47 EDT 1986
  295.          Sun           %a                  Sun Sep 28 12:19:47 EDT 1986
  296.          Fri           %a                  Fri Sep 26 12:19:47 EDT 1986
  297.          September     %B                  Mon Sep  1 12:19:47 EDT 1986
  298.          January       %B                  Thu Jan  1 12:19:47 EST 1987
  299.          December      %B                  Mon Dec  1 12:19:47 EST 1986
  300.          Sep Mon       %b %a               Mon Sep  1 12:19:47 EDT 1986
  301.          Jan Fri       %b %a               Fri Jan  2 12:19:47 EST 1987
  302.          Dec Mon       %b %a               Mon Dec  1 12:19:47 EST 1986
  303.          Jan Wed 1989  %b %a %Y            Wed Jan  4 12:19:47 EST 1989
  304.          Fri 9         %a %H               Fri Sep 26 09:00:00 EDT 1986
  305.          Feb 10:30     %b %H:%S            Sun Feb  1 10:00:30 EST 1987
  306.          10:30         %H:%M               Tue Sep 23 10:30:00 EDT 1986
  307.          13:30         %H:%M               Mon Sep 22 13:30:00 EDT 1986
  308.  
  309. AAAAPPPPPPPPLLLLIIIICCCCAAAATTTTIIIIOOOONNNN UUUUSSSSAAAAGGGGEEEE
  310.      Although historical versions of _gggg_eeee_tttt_dddd_aaaa_tttt_eeee_((((_)))) did not require that _<<<<_tttt_iiii_mmmm_eeee_...._hhhh_>>>>
  311.      declare the external variable _gggg_eeee_tttt_dddd_aaaa_tttt_eeee______eeee_rrrr_rrrr, this document does require it.
  312.      The Open Group encourages applications to remove declarations of
  313.      _gggg_eeee_tttt_dddd_aaaa_tttt_eeee______eeee_rrrr_rrrr and instead incorporate the declaration by including
  314.      _<<<<_tttt_iiii_mmmm_eeee_...._hhhh_>>>>.
  315.  
  316. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  317.      _cccc_tttt_iiii_mmmm_eeee_((((_)))), _cccc_tttt_yyyy_pppp_eeee_((((_)))), _llll_oooo_cccc_aaaa_llll_tttt_iiii_mmmm_eeee_((((_)))), _ssss_eeee_tttt_llll_oooo_cccc_aaaa_llll_eeee_((((_)))), _ssss_tttt_rrrr_ffff_tttt_iiii_mmmm_eeee_((((_)))), _tttt_iiii_mmmm_eeee_ssss_((((_)))), _<<<<_tttt_iiii_mmmm_eeee_...._hhhh_>>>>
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.